<template>
	<view class="fanganpage">
		<view class="pagetitle">
			<view class="iconfont icon-jiejuefangan">
				
			</view>
			用户信息
		</view>
		<view class="infobox">
			<view class="numberline">
				<view class="numberbox">
					
				</view>
				<view class="numberbox">
					时间：{{member.createTime}}
				</view>
			</view>
			 <view class="line">
			 	
			 </view>
			 <view class="info">
			 	<view class="labelbox">
			 		<view class="label">
			 			姓名：
			 		</view>
					<view class="value">
						{{member.yzName||''}}
					</view>
			 	</view>
				<view class="labelbox">
					<view class="label">
						性别：
					</view>
					<view class="value">
						{{member.yzSex||''}}
					</view>
				</view>
				<view class="labelbox">
					<view class="label">
						年龄：
					</view>
					<view class="value">
						{{member.yzAge||''}}
					</view>
				</view>
				<view class="labelbox">
					<view class="label">
						身高(cm)：
					</view>
					<view class="value">
						
					</view>
				</view>
				<view class="labelbox">
					<view class="label">
						科室：
					</view>
					<view class="value">
						{{member.yzDepartment||''}}
					</view>
				</view>
				<view class="labelbox">
					<view class="label">
						会员等级：
					</view>
					<view class="value">
						专病服务
					</view>
				</view>
			 </view>
		</view>
		<view class="tabbox">
			<view class="itemtab act" >
				报告详情
				<view class="line"></view>
			</view>
			
		</view>
		
		
		<!-- <view class="put"    >{{plan.orContent||''}}</view> -->
		<view class="form-item">
		  <textarea
		    class="put"
		    v-model="plan.orContent"
		    placeholder="请输入您的内容"
		    :auto-height="true"
		    :show-confirm-bar="false"
		    :disable-default-padding="true"
		    :adjust-position="true"
		    maxlength="-1"
		  />
		</view>
		<view class="footbtn" >
			<view class="btn"  v-if="member.yzStatus==1" @click="put">
				提交审核
			</view>
			<view class="btn" v-if="member.yzStatus==2" @click="passplan">
				审核通过
			</view>
			<view class="btn" v-if="member.yzStatus==2||member.yzStatus==1" @click="baocun">
				保存
			</view>
		</view>
		
		
		<view class="winpage" v-if="winshow">
			<view class="win">
				<view class="iconfont  icon-guanbi"></view>
				<textarea class="put" ></textarea>
				<view class="winbtn">
					提交
				</view>
			</view>
			
		</view>
	</view>
</template>

<script>
	import {getMemberMedicalOrderDetail,passPlan,submitPlan,updatePlan} from '../../utils/api.js'
	export default {
		data() {
			return {
				tab:1,
				winshow:false,
				id:'',
				mid:'',
				member:{},
				plan:{},
				planA:{},
				planB:{},
				planC:{},
			}
		},
		onLoad(e) {
			this.id=e.id,
			this.mid=e.mid
			
			let p={
				phone:uni.getStorageSync('phone'),
				yzId:this.id
			}
			getMemberMedicalOrderDetail(p).then(res=>{
				console.log(res)
				this.member=res.data.data.yzInfo
				this.plan=res.data.data.planA
				
			})
		},
		methods: {
		put(){
		  let that=this
		  uni.showModal({
		  	title: '提示',
		  	content: '提交方案',
		  	success: function (res) {
		  		if (res.confirm) {
		  			console.log('用户点击确定');
		  			
		  			let p={
		  				phone:uni.getStorageSync('phone'),
		  				planId:that.plan.id,
		  				memberId:that.mid,
		  				yzId:that.member.id
		  				
		  			}
		  			submitPlan(p).then(res=>{
		  				console.log(res)
		  				if(res.data.code==200){
		  					uni.showToast({
		  						title: '提交成功',
		  						icon:'none',
		  						duration: 2000
		  					});
		  					uni.navigateBack()
		  
		  				}
		  			})
		  		} else if (res.cancel) {
		  			console.log('用户点击取消');
		  		}
		  	}
		  });
		  	
		},
			baocun(){
				console.log("点击")
				 const content = this.plan.orContent;
				  console.log('当前输入的内容：', content);
				    console.log('当前输入的内容：', this.plan.id);
				
				    // 如果内容为空，可提示用户
				    if (!content || content.trim() === '') {
				      uni.showToast({
				        title: '内容不能为空',
				        icon: 'none'
				      });
				      return;
				    }
					let p={
						phone:uni.getStorageSync('phone'),
						id:this.plan.id,
						content:this.plan.orContent
					}
					updatePlan(p).then(res=>{
						console.log(res)
						
						/* uni.showToast({
						  title: '内容不能为空',
						  icon: 'none'
						}); */
						
					})
					
					
			},
			passplan(){
				let that=this
				uni.showModal({
					title: '提示',
					content: '审核通过',
					success: function (res) {
						if (res.confirm) {
							console.log('用户点击确定');
							
							let p={
								phone:uni.getStorageSync('phone'),
								planId:that.plan.id,
								memberId:that.mid,
								yzId:that.member.id
								
							}
							passPlan(p).then(res=>{
								console.log(res)
								if(res.data.code==200){
									uni.showToast({
										title: '提交成功',
										icon:'none',
										duration: 2000
									});
									uni.navigateBack()

								}
							})
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					}
				});

			},
		}
	}
</script>

<style lang="less" scoped>
 .fanganpage{
	 width: 750rpx;
	 box-sizing: border-box;
	 padding: 40rpx 20rpx;
	 padding-bottom: 100rpx;
	 .pagetitle{
		 display: flex;
		 align-items: center;
		 color: #1a4f8a;
		 font-weight: bold;
		 font-size: 34rpx;
		 margin-bottom: 20rpx;
		 .iconfont{
			 margin-right: 20rpx;
			 font-size: 44rpx;
		 }
	 }
	 .infobox{
		 margin: 20rpx 0;
		 width: 100%;
		 background-color: white;
		 box-sizing: border-box;
		 padding: 20rpx;
		 .numberline{
			 display: flex;
			 align-items: center;
			 line-height: 2.2;
			 font-size: 24rpx;
			 font-weight: bold;
			 .numberbox{
				 margin-right: 40rpx;
			 }
		 }
		 .line{
			 width: 100%;
			 border-top: 8rpx solid #1a4f8a;
			 border-bottom: 1rpx solid #1a4f8a;
			 padding: 4rpx 0;
			 margin: 20rpx 0;
		 }
		 .info{
			 width: 100%;
			  display: flex;
			  align-items: flex-start;
			  flex-wrap: wrap;
			  line-height: 2.2;
			  .labelbox{
				  display: flex;
				  align-items: center;
				  width: 33%;
				  font-size: 22rpx;
				  font-weight: bold;
				  .value{
					  font-size: 26rpx;
					  color: #1a4f8a;
				  }
			  }
			  
		 }
	 }
	 .tabbox{
		width: 100%;
		 display: flex;
		 align-items: center;
		 .itemtab{
			 width: 150rpx;
			 text-align: center;
			 box-sizing: border-box;
			 color: gray;
			 font-weight: bold;
			 margin: 0 20rpx;
			 .line{
				 width: 70rpx;
				 height: 8rpx;
				 border-radius: 4rpx;
				 margin: 4rpx auto;
				 
			 }
		 }
		 .act{
			 color: #1a4f8a;
			 font-size: 34rpx;
			 .line{
				 background-color: #1a4f8a;
			 }
		 }
	 }
/* 	 .put{
		 width: 100%;
		
		 margin-top: 20rpx;
		 border-radius: 20rpx;
		 box-sizing: border-box;
		 padding: 20rpx;
	 } */
	 .form-item {
	   width: 100%;
	   padding: 20rpx;
	   box-sizing: border-box;
	 }
	 
	 .put {
	   width: 100%;
	   min-height: 200rpx;
	   font-size: 28rpx;
	   line-height: 1.6;
	   padding: 20rpx;
	   background-color: #fff;
	   border-radius: 16rpx;
	   border: 1px solid #eee;
	   box-sizing: border-box;
	   word-wrap: break-word;
	   word-break: break-all;
	   white-space: pre-wrap;
	 }
	 
	 // 关键：给整个底部按钮容器设置 z-index
	 .footbtn {
	   width: 100%;
	   background-color: white;
	   display: flex;
	   padding: 10rpx 20rpx;
	   align-items: center;
	   justify-content: space-between;
	   position: fixed;
	   bottom: 20rpx;
	   left: 0;
	   box-sizing: border-box;
	   z-index: 9999; /* 👈 设置在父容器上，更可靠 */
	 
	   .btn, .btn1 {
	     width: 45%;
	     height: 70rpx;
	     border-radius: 35rpx;
	     box-sizing: border-box;
	     text-align: center;
	     line-height: 70rpx;
	     color: white;
	     background-color: #1a4f8a;
	     border: 1rpx solid #1a4f8a;
	   }
	 
	   // 如果 .btn1 是无边框样式，可单独调整
	   .btn1 {
	     border: none;
	   }
	 }
	 .winpage{
		 width: 750rpx;
		 height: 100vh;
		 background-color: rgba(0, 0, 0, 0.5);
		 position: fixed;
		 top: 0;
		 left: 0;
		 right: 0;
		 .win{
			 width: 100%;
			 height: 70vh;
			 position: absolute;
			 bottom: 0;
			 border-top-right-radius: 20rpx;
			 border-top-left-radius: 20rpx;
			 box-sizing: border-box;
			 padding: 20rpx;
			 background-color: whitesmoke;
			 .icon-guanbi{
				 position: absolute;
				 right: 20rpx;
				 top: 20rpx;
				 color: black;
				 font-weight: bold;
			 }
			 .put{
				 margin-top: 40rpx;
				 height: 50vh;
				 border: 1rpx solid #999999;
				 background-color: white;
			 }
			 .winbtn{
				 width: 86%;
				 height: 80rpx;
				 margin: 40rpx auto;
				 border-radius: 40rpx;
				 text-align: center;
				 line-height: 80rpx;
				 font-size: 30rpx;
				 font-weight: bold;
				 background-color: #1a4f8a;
				 color: white;
			 }
		 }
	 }
 }
</style>
